//
//  clsBaseGhost.cpp
//  NewMath
//
//  Created by Ngô Hoàng Nam on 12/30/14.
//
//

#include "BaseGhostObj.h"
float BaseGhostObj::m_distanceStar_Ghost = 10;

BaseGhostObj::BaseGhostObj()
{}

void BaseGhostObj::initGhost(std::string ghostSprite, cocos2d::Vec2 Position, float kScale)
{
   
    this->setAnchorPoint(Vec2(0.5f,0.5f));
    
    m_Ghost = Button::create();
    m_Ghost->loadTextures(ghostSprite, ghostSprite);
    
    m_Ghost->setPosition(Position);
    m_eye = Sprite::create("ghost_eye.png");
    m_mouth = Sprite::create("ghost_mouth.png");
    m_LeftHand = Sprite::create("left_hand.png");
    m_RightHand = Sprite::create("right_hand.png");
    
    m_Ghost->setScale(kScale);
    
    m_eye->setScale(kScale);
    m_mouth->setScale(kScale);
    m_LeftHand->setScale(kScale);
     m_RightHand->setScale(kScale);
    
    m_eye->setPosition(Vec2(m_Ghost->getPosition().x,m_Ghost->getPosition().y));
    m_mouth->setPosition(Vec2(m_eye->getPosition().x,m_eye->getPosition().y - m_eye->getContentSize().height*kScale));
    m_LeftHand->setPosition(m_Ghost->getPosition().x + m_LeftHand->getContentSize().width*kScale/3*2,m_Ghost->getPosition().y);
    m_RightHand->setPosition(m_Ghost->getPosition().x - m_RightHand->getContentSize().width*kScale/3*2,m_Ghost->getPosition().y);
   
    
    
    
    
    this->addChild(m_LeftHand);
    this->addChild(m_RightHand);
     this->addChild(m_Ghost);
    this->addChild(m_eye);
    this->addChild(m_mouth);

    mySetVisible(true);
}
void BaseGhostObj::addToLayer(cocos2d::Node *node, BaseGhostObj *ghost)
{
 
    node->addChild(ghost);
}
void BaseGhostObj::mySetVisible(bool visible)
{
    this->setVisible(visible);
    this->m_isVisible = visible;
}
bool BaseGhostObj::myGetVisible()
{
    bool b=  m_isVisible;
    return this->m_isVisible;
}

